<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            background-color: pink;
        }
    </style>
</head>

<body>
    <div id="test"></div>

    <!-- 引入核心库 -->
    <script type="text/javascript" src="./React-js/16.8/react.development.js"></script>
    <!-- 用于支持react操作DOM -->
    <script text="text/javascript" src="./React-js/16.8/react-dom.development.js"></script>
    <!-- 用于将jsx转换为js -->
    <script text="text/javascript" src="./React-js/16.8/babel.min.js"></script>

    <script type="text/babel">
        class Demo extends React.Component{
            // 展示左侧输入框的数据
            showData = ()=>{
                alert(this.refs.inp1.value)
            }
            // 展示左侧输入框的数据
            showData2 = ()=>{
                alert(this.refs.inp2.value)
            }
            render(){
                return(
                    <div>
                        <input ref="inp1" type="text" placeholder="点击按钮提示数据"/>
                        <button onClick={this.showData}>点击提示左侧的数据</button>&nbsp;
                        <input ref="inp2" onBlur={this.showData2} type="text" placeholder="失去焦点提示数据"/>
                    </div>
                )
            }
        }

        ReactDOM.render(<Demo/>,document.querySelector('#test'))
    </script>
</body>

</html>